package com.masterclient.app.modules.income.adapter;

import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.text.TextUtils;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.masterclient.app.R;
import com.masterclient.app.modules.income.model.ProfitsTypePopupBean;

import java.util.List;

/**
 * @auther hjian
 * @date 2020/6/16.
 */
public class ProfitTypeDialogAdapter extends BaseQuickAdapter<ProfitsTypePopupBean, BaseViewHolder> {

    public ProfitTypeDialogAdapter(List<ProfitsTypePopupBean> data) {
        super(R.layout.item_profit_dialog, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, ProfitsTypePopupBean item) {
        helper.setText(R.id.item_profit_dialog_title, item.getSub_title())
                .setGone(R.id.item_profit_dialog_title,!TextUtils.isEmpty(item.getSub_title()))
                .setGone(R.id.item_profit_dialog_recycler, true)
                .setGone(R.id.item_profit_dialog_desc, false);
        RecyclerView recyclerView = helper.getView(R.id.item_profit_dialog_recycler);
        recyclerView.setLayoutManager(new LinearLayoutManager(mContext){
            @Override
            public boolean canScrollVertically() {
                return false;
            }
        });
        recyclerView.setAdapter(new ProfitTypeDialogChildAdapter(item.getContent()));
    }
}
